﻿// SandBox2.0.cpp: 定义应用程序的入口点。
//

#include "include/commands.h"
#include "include/processor.h"
#include "include/debugger.h"
#include "include/memory.h"
#include "include/filehandle.h"

extern qword iregs[128];
extern real4 fregs[32];
extern real8 dregs[32];
extern VREG vregs[64];
extern std::fstream disk;
extern Table gdt[4096];
extern byte ram[MAX_MEM];

#ifdef __debug__
int main()
{
	init();
	selector(loader());
	std::string filename;
	std::cout << "Input File Name:";
	std::cin >> filename;
	getHeader(filename.c_str());
	getPage(filename.c_str());
	loadImage(filename.c_str());
	while (1)
	{
		debug_main(0);
	}
}
#else
int main(int argc, char **argv)
{
	init();
	selector(loader(iregs[Code]));
	if (argc < 3)
	{
		std::cout << "fatal error:please find a file.\n";
		exit(-1);
	}
	getHeader(argv[1]);
	getPage(argv[1]);
	loadImage(argv[1]);
	while (1)
	{
		debug_main(1, argv[2]);
	}
}
#endif